package com.kevin.mapping.script.lexer;

import com.kevin.mapping.script.engine.JSONEnv;

import java.math.BigDecimal;

public class Token implements IToken {
    public final int type;

    public Token(int type) {
        this.type = type;
    }

    public Object getValue(JSONEnv evn) {
        return toString();
    }

    public String toString() {
        return "" + (char) type;
    }

    @Override
    public Integer getIntValue(JSONEnv env) {
        return type;
    }


    @Override
    public Long getLongValue(JSONEnv env) {
        return (long) type;
    }

    @Override
    public Double getDoubleValue(JSONEnv env) {
        return (double) type;
    }

    @Override
    public BigDecimal getBigDecimalValue(JSONEnv env) {
        return BigDecimal.valueOf(type);
    }

    @Override
    public String getStrValue(JSONEnv env) {
        return String.valueOf(type);
    }

    @Override
    public Object getObjectValue(JSONEnv env) {
        return type;
    }
}
